#include "listitem.h"
#include <QFileInfo>

ListItem::ListItem(Phrase& p, QListWidget* parent = 0)
        // use icon. relative to /icons folder
        : QListWidgetItem(QIcon(QString("cartoons/").append(p.getCartoonFilename())),
                          p.getName(), parent, 0)
{
    phrase = p;//stores the file name
}

Phrase ListItem::getPhrase()
{
    return phrase;
}

void ListItem::setPhrase(Phrase &p)
{
    phrase = p;
    this->setIcon(QIcon(QString("cartoons/").append(p.getCartoonFilename())));
    this->setText(p.getName());
}
